<template>
  <div class="list">
    <el-breadcrumb saperator="/">
      <el-breadcrumb-item :to="{path:'/'}">首页</el-breadcrumb-item>
      <el-breadcrumb-item>政策法规列表页</el-breadcrumb-item>
    </el-breadcrumb>
    <div class="main">
      <el-table
        v-loading="loading"
        :data="dataList"
        :header-cell-style="{
          background:'#f6fdfd',color:'#000',height:'44px'
        }"
        :row-style="{height:'50px'}"
        @row-click="goDetail"
      >
        <el-table-column label="序号" type="index" width="244"></el-table-column>
        <el-table-column label="政策法规标题" prop="title" width="530"></el-table-column>
        <el-table-column label="发布时间" prop="publishDatetime">
          <template slot-scope="scope">
            {{ parseTime(scope.row.publishDatetime,'{y}-{m}-{d}') }}
          </template>
        </el-table-column>
      </el-table>
      <Pagination
        v-show="total > 0"
        :limit.sync="queryParams.pageSize"
        :page.sync = "queryParams.pageNum"
        :total="total"
        @pagination="getData"
      />
    </div>
  </div>
</template>

<script>
import {listPolicylaw} from '@/api/bid/policylaw'
export default {
  name: "list",
  data() {
    return {
      loading:true,
      dataList:[],
      queryParams:{
        pageSize:20,
        pageNum:1
      },
      total:0
    }
  },
  mounted() {
    this.getData()
  },
  methods: {
    getData(){
      listPolicylaw(this.queryParams).then(res=>{
        this.dataList = res.rows
        this.total = res.total
        this.loading = false
      })
    },
    goDetail(row){
      this.$router.push('/policylaw/detail?id='+row.id)
    }
  }
}
</script>

<style lang="scss" scoped>
.list{

  .main{
    margin: 20px;
    padding: 15px;
    width: 80%;
    background-color: #fff;
    border-radius: 5px;
  }
}

::v-deep .el-pagination{
  position: relative;
  display: flex;
  justify-content: center;
}

::v-deep .el-pager .active{
  color: #1dd0b7;
}
</style>
